//
// Created by Jisam on 2024/7/14.
//
#include"iostream"
#include "iomanip"
using  namespace  std;
int main(){
    long double i = 1.0;
    long double j = 1000000000.0;
    long double ans = 0;
    int f = 0;
    while (i <= j){
        if(f){
            ans -= 1 / i;
            f = 0;
        }else {
            ans += 1 / i;
            f = 1;
        }
        i += 2;
        if((int)i % ((int)j / 1000) == 1){
            cout <<fixed <<setprecision(0)<< "calculating: "<<i ;
            cout <<fixed <<setprecision(10)<< " pi: "<< ans * 4<<"\n";
        }
//        cout << (int)i % 1000 << " ";
    }
    cout <<fixed <<setprecision(100)<<"final pi:"<< ans * 4;
    return  0;
}